package io;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.Scanner;

/**
 * 练习：简易记事本
 * */
public class Test2 {
    public static void main(String[] args) throws IOException {
        Scanner scan = new Scanner(System.in);
        FileOutputStream fos = new FileOutputStream("note.txt",true);
        while (true){
            String line = scan.next();
            if("exit".equalsIgnoreCase(line)){
                break;
            }
            byte[] data = line.getBytes(StandardCharsets.UTF_8);
            System.out.println(Arrays.toString(data));
            fos.write(data);
        }
        System.out.println("再见");
        fos.close();
    }
}
